<?php
class PHPAction extends Action{
		
	function index(){
	    $arr = $this->gf();
		foreach ($arr as $k=>$v){
			$list[] = explode('||',$v);
			$list[$k][2] = msubstr(strip_tags($list[$k][2]),0,64).'......';
		}
		$this->assign('list',$list);
		$this->display('web@php');
	}
	
	function show(){
		$name = $_GET['name'];
		$content = file_get_contents('Tpl/pages/'.$name.'.html');
		
		$lab = explode('||',$content);
		
		$this->assign('lab',$lab);
		
		$this->display('web@php_show');
	}

	function gf(){
		$dir = dir('Tpl/pages');
		while (($file = $dir->read()) !== false){
			if(strlen($file)>6){
				$arr[] = $file . '||' . file_get_contents('Tpl/pages/'.$file);
			}
		}
		
		$dir->close();
		return $arr;
	}
}
?>